import { Controller } from 'egg';

export default class AdminLoginController extends Controller {
    public async login() {
        const { ctx, service } = this;
        ctx.validate({
            username: 'string',
            password: 'string',
        });
        const { username, password } = ctx.request.body;
        const user = await service.admin.login.login(username, password);
        ctx.helper.success(ctx, user);
    }
}
